import type { VbenFormSchema } from '#/adapter/form';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MakeupArtistApi } from '#/api/wedding/makeupartist';

import { z } from '#/adapter/form';
import {
    getDictOptions,
    getRangePickerDefaultProps,
} from '#/utils';

import {formatDressStatus}from '#/utils/wedding'

/** 新增/修改的表单 */
export function useFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'id',
      component: 'Input',
      dependencies: {
        triggerFields: [''],
        show: () => false,
      },
    },
    {
      fieldName: 'artistCode',
      label: '化妆师编码',
      rules: 'required',
      component: 'Input',
      componentProps: {
        placeholder: '请输入化妆师编码',
      },
    },
    {
      fieldName: 'artistName',
      label: '姓名',
      rules: 'required',
      component: 'Input',
      componentProps: {
        placeholder: '请输入姓名',
      },
    },
    {
      fieldName: 'level',
      label: '等级',
      component: 'Input',
      componentProps: {
        placeholder: '请输入等级',
      },
    },
    {
      fieldName: 'specialtyStyle',
      label: '擅长风格',
      component: 'Input',
      componentProps: {
        placeholder: '请输入擅长风格',
      },
    },
    {
      fieldName: 'servicePrice',
      label: '服务价格',
      component: 'Input',
      componentProps: {
        placeholder: '请输入服务价格',
      },
    },
    {
      fieldName: 'rating',
      label: '评分(0-5)',
      component: 'Input',
      componentProps: {
        placeholder: '请输入评分(0-5)',
      },
    },
    {
      fieldName: 'serviceCount',
      label: '服务次数',
      component: 'Input',
      componentProps: {
        placeholder: '请输入服务次数',
      },
    },
    {
      fieldName: 'status',
      label: '状态',
      component: 'RadioGroup',
      componentProps: {
        options: formatDressStatus(),
        buttonStyle: 'solid',
        optionType: 'button',
      },
    },
    {
      fieldName: 'remark',
      label: '备注',
      component: 'Input',
      componentProps: {
        placeholder: '请输入备注',
      },
    },
  ];
}

/** 列表的搜索表单 */
export function useGridFormSchema(): VbenFormSchema[] {
  return [
    {
      fieldName: 'artistCode',
      label: '化妆师编码',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入化妆师编码',
      },
    },
    {
      fieldName: 'artistName',
      label: '姓名',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入姓名',
      },
    },
    {
      fieldName: 'level',
      label: '等级',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入等级',
      },
    },
    {
      fieldName: 'specialtyStyle',
      label: '擅长风格',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入擅长风格',
      },
    },
    {
      fieldName: 'servicePrice',
      label: '服务价格',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入服务价格',
      },
    },
    {
      fieldName: 'rating',
      label: '评分(0-5)',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入评分(0-5)',
      },
    },
    {
      fieldName: 'serviceCount',
      label: '服务次数',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入服务次数',
      },
    },
    {
      fieldName: 'status',
      label: '状态',
      component: 'Select',
      componentProps: {
        allowClear: true,
        options: formatDressStatus(),
        placeholder: '请选择状态',
      },
    },
    {
      fieldName: 'remark',
      label: '备注',
      component: 'Input',
      componentProps: {
        allowClear: true,
        placeholder: '请输入备注',
      },
    },
    {
      fieldName: 'createTime',
      label: '创建时间',
      component: 'RangePicker',
      componentProps: {
        ...getRangePickerDefaultProps(),
        allowClear: true,
      },
    },
  ];
}

/** 列表的字段 */
export function useGridColumns(): VxeTableGridOptions<MakeupArtistApi.MakeupArtist>['columns'] {
  return [
    {
      field: 'id',
      title: '',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'artistCode',
      title: '化妆师编码',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'artistName',
      title: '姓名',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'level',
      title: '等级',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'specialtyStyle',
      title: '擅长风格',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'servicePrice',
      title: '服务价格',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'rating',
      title: '评分(0-5)',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'serviceCount',
      title: '服务次数',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'status',
      title: '状态',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'remark',
      title: '备注',
      minWidth: 120,
      // cellRender: {
      //   name: 'CellDict',
      //   props: { type: DICT_Wedding_TYPE.HandCardTypeStatus.toUpperCase() },
      // },
    },
    {
      field: 'createTime',
      title: '创建时间',
      minWidth: 120,
      formatter: 'formatDateTime',
    },
    {
      title: '操作',
      width: 200,
      fixed: 'right',
      slots: { default: 'actions' },
    },
  ];
}

